import { defineStore } from 'pinia'

export const useMainStore = defineStore('main', {
  state: () => ({
    count: 0,
    name: 'Tom',
    age: 25,
    isLogin: false,
    token: ''
  }),
  getters: {
    doubleCount: (state) => state.count * 2
  },
  actions: {
    increment(amount: number) {
      this.count += amount
    },
    setName(name: string) {
      this.name = name
    },
    setAge(age: number) {
      this.age = age
    },
    setLogin(isLogin: boolean) {
      this.isLogin = isLogin
    },
    setToken(token: string) {
      this.token = token

    }
  }
})